package adapter;

import android.support.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;

import bean.ItemBean;
import bean.StudyReportBean;
import bean.StudyReportDetailBean;
import student.andlei.com.student.R;
import utils.StringUtils;

public class StudyReportAdapter extends BaseQuickAdapter<StudyReportDetailBean.Rank,BaseViewHolder>{


    public StudyReportAdapter(int layoutResId, @Nullable List data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, StudyReportDetailBean.Rank item) {

        helper.setText(R.id.tv_rank, (StringUtils.isNull(item.sort)||item.sort.equals("-"))?"1":item.sort);
        helper.setText(R.id.tv_name,StringUtils.isNull(item.student_name)?"-":item.student_name);
        helper.setText(R.id.tv_coligate,StringUtils.isNull(item.total)?"-":item.total);
        for(StudyReportDetailBean.Rank.Subjects subjects : item.subjects){
            if(subjects.subject_name.equals("语文")){
                helper.setText(R.id.tv_chinese,StringUtils.isNull(subjects.subject_score)?"-":subjects.subject_score);
            }else if(subjects.subject_name.equals("数学")){
                helper.setText(R.id.tv_math,StringUtils.isNull(subjects.subject_score)?"-":subjects.subject_score);
            }else if(subjects.subject_name.equals("英语")){
                helper.setText(R.id.tv_english,StringUtils.isNull(subjects.subject_score)?"-":subjects.subject_score);
            }else if(subjects.subject_name.equals("物理")){
                helper.setText(R.id.tv_physics,StringUtils.isNull(subjects.subject_score)?"-":subjects.subject_score);
            }else if(subjects.subject_name.equals("化学")){
                helper.setText(R.id.tv_chemistry,StringUtils.isNull(subjects.subject_score)?"-":subjects.subject_score);
            }else if(subjects.subject_name.equals("生物")){
                helper.setText(R.id.tv_biology,StringUtils.isNull(subjects.subject_score)?"-":subjects.subject_score);
            }else if(subjects.subject_name.equals("历史")){
                helper.setText(R.id.tv_history,StringUtils.isNull(subjects.subject_score)?"-":subjects.subject_score);
            }else if(subjects.subject_name.equals("科学")){
                helper.setText(R.id.tv_science,StringUtils.isNull(subjects.subject_score)?"-":subjects.subject_score);
            }else if(subjects.subject_name.equals("信息技术")){
                helper.setText(R.id.tv_information,StringUtils.isNull(subjects.subject_score)?"-":subjects.subject_score);
            }else if(subjects.subject_name.equals("内部课程")){
                helper.setText(R.id.tv_internalcourse,StringUtils.isNull(subjects.subject_score)?"-":subjects.subject_score);
            }else if(subjects.subject_name.equals("会议")){
                helper.setText(R.id.tv_meeting,StringUtils.isNull(subjects.subject_score)?"-":subjects.subject_score);
            }else {

            }
        }

//        helper.setText(R.id.tv_math,StringUtils.isNull(item.math)?"-":item.math);
//        helper.setText(R.id.tv_english,StringUtils.isNull(item.english)?"-":item.english);
//        helper.setText(R.id.tv_physics,StringUtils.isNull(item.physics)?"-":item.physics);
//        helper.setText(R.id.tv_chemistry,StringUtils.isNull(item.chemistry)?"-":item.chemistry);
//        helper.setText(R.id.tv_biology,StringUtils.isNull(item.biology)?"-":item.biology);
//        helper.setText(R.id.tv_history,StringUtils.isNull(item.history)?"-":item.history);
//        helper.setText(R.id.tv_science,StringUtils.isNull(item.science)?"-":item.science);
//        helper.setText(R.id.tv_information,StringUtils.isNull(item.information)?"-":item.information);
//        helper.setText(R.id.tv_internalcourse,StringUtils.isNull(item.internalcourse)?"-":item.internalcourse);
//        helper.setText(R.id.tv_meeting,StringUtils.isNull(item.meeting)?"-":item.meeting);
    }


}
